﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Web;

namespace ZHDJ.MobileInterface.Common
{
    public class LawCs
    {
//        /// <summary>
//        /// 获取律师详情
//        /// </summary>
//        public static DataSet Lawyer(string ID)
//        {
//            using (SqlCommand cmd = new SqlCommand())
//            {
//                string sql = string.Format(@"select a.*,b.MobileNo as MobileNoEx,b.UserName,
//(select COUNT(1) from tblPartyLawConsultation where Lawyer=a.LoginID and DianZan=1) as DianZan from tblPartyLawyer a
//                                            left join tblPartyOrgMembers  b on a.LoginID=b.LoginID where a.LoginID='{0}'", ID);
//                cmd.CommandText = sql;
//                DataSet ds = DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(cmd);
//                return ds;
//            }
//        }

//        /// <summary>
//        /// 获取律师积分
//        /// </summary>
//        public static DataSet LawyerScore(string ID, int page_no, int page_count, string IsMobileService)
//        {
//            string field = string.Empty;
//            string table = string.Empty;
//            string where = string.Empty;
//            string orderBy = string.Empty;
//            StringBuilder sbsql = new StringBuilder();
//            field = " a.*,b.UserName ";
//            table = " tblPartyLawScoreRecord a left join tblPartyOrgMembers b on a.Lawyer=b.LoginID  ";
//            where = string.Format("1=1 and a.Lawyer='{0}'", ID);
//            orderBy = "a.CreateTime desc";
//            return SXT.Party.Law.BLL.CommonUtils.QueryByPage(field, table, where, orderBy, page_no, page_count, IsMobileService);
//        }

//        /// <summary>
//        /// 获取总积分
//        /// </summary>
//        /// <param name="ID"></param>
//        /// <returns></returns>
//        public static DataSet LawyerAllScore(string ID)
//        {
//            using (SqlCommand cmd = new SqlCommand())
//            {
//                string sql = "select SUM(score) as AllScore from  tblPartyLawScoreRecord where  Lawyer='" + ID + "'";
//                cmd.CommandText = sql;
//                return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(cmd);
//            }
//        }
//        /// <summary>
//        /// 检查回复ID是否存在
//        /// </summary>
//        /// <param name="ID"></param>
//        /// <returns></returns>
//        public static bool CheckReplyID(string ID)
//        {
//            using (SqlCommand cmd = new SqlCommand())
//            {
//                string sql = string.Format(@" select *from tblPartyLawConsultationReply where ReplyID='{0}'", ID);
//                cmd.CommandText = sql;
//                DataSet ds = DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(cmd);
//                if (ds.Tables[0].Rows.Count > 0)
//                    return false;
//                else return true;
//            }
//        }

//        /// <summary>
//        /// 检查律师与咨询ID是否存在
//        /// </summary>
//        /// <param name="ID"></param>
//        /// <returns></returns>
//        public static bool CheckConsultationIDID(string ConsultationID,string LawyerID)
//        {
//            using (SqlCommand cmd = new SqlCommand())
//            {
//                string sql = string.Format(@" select * from tblPartyLawConsultation where ConsultationID='{0}' and Lawyer='{1}'", ConsultationID,LawyerID);
//                cmd.CommandText = sql;
//                DataSet ds = DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteDataSet(cmd);
//                if (ds.Tables[0].Rows.Count > 0)
//                    return false;
//                else return true;
//            }
//        }

//        /// <summary>
//        /// 编辑回复
//        /// </summary>
//        /// <param name="RContent"></param>
//        /// <param name="ReplyID"></param>
//        /// <returns></returns>
//        public static bool UpdatePartyLawConsultationReply(string RContent, string ReplyID)
//        {
//            using (SqlCommand cmd = new SqlCommand())
//            {
//                StringBuilder sbsql = new StringBuilder();
//                sbsql.Append(@" update tblPartyLawConsultationReply set Content =@Content where ReplyID=@ReplyID");
//                cmd.Parameters.Add("@ReplyID", SqlDbType.NVarChar).Value = ReplyID;
//                cmd.Parameters.Add("@RContent", SqlDbType.NVarChar).Value = RContent;
//                cmd.CommandText = sbsql.ToString();
//                return DB.DBManager.DBSettings["SXT.DefaultDBEx"].ExecuteNonQuery(cmd) > 0;
//            }
//        }
    }
}